package com.tanhua.dubbo.api;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tanhua.dubbo.mappers.AnnouncementMapper;
import com.tanhua.model.domain.Announcement;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class AnnouncementApiImpl implements AnnouncementApi {
    @Autowired
    private AnnouncementMapper announcementMapper;

    @Override
    public List<Announcement> announcements(Integer page, Integer pagesize) {
        Page<Announcement> announcementPage = new Page<>(page, pagesize);
        LambdaQueryWrapper<Announcement> lambdaQueryWrapper=new LambdaQueryWrapper<>();
        Page<Announcement> announcementPage1 = announcementMapper.selectPage(announcementPage, lambdaQueryWrapper);
        List<Announcement> records = announcementPage1.getRecords();
        return records;
    }
}
